package com.xuecheng.media.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Sober_wxy
 * @date 2022/7/21 22:22
 */
@Configuration
@Data
@ConfigurationProperties(prefix = "aliyun")
public class AliyunProperties {
        private String region;
        private String accessKeyId;
        private String accessKeySecret;

        @Bean
        public DefaultAcsClient client() {
                DefaultProfile profile = DefaultProfile.getProfile(
                        region,
                        accessKeyId,
                        accessKeySecret);
                return new DefaultAcsClient(profile);
        }
}
